package utils;

import play.mvc.Scope;

/**
 * @author yangzhi
 * @date 2018/10/8
 */
public class UserUtils {

	public static String getOpenId() {
		if (Scope.Session.current().contains("openId")) {
			String openId = String.valueOf(Scope.Session.current().get("openId"));
			return openId;
		}else {
			return "";
		}
	}
	public static void setOpenId(String openId) {
		if (openId != null) {
			Scope.Session.current().put("openId", String.valueOf(openId));
		}
	}

	public static String getAccessToken() {
		if (Scope.Session.current().contains("accessToken")) {
			String accessToken = String.valueOf(Scope.Session.current().get("accessToken"));
			return accessToken;
		}else {
			return "";
		}
	}
	public static void setAccessToken(String accessToken) {
		if (accessToken != null) {
			Scope.Session.current().put("accessToken", String.valueOf(accessToken));
		}
	}
}
